﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 索引函数
{
    public class Contact
    {
        private string _name;
        private string _homePhone;
        private string _mobilePhone;
        private string _busiPhone;
        private string _fax;

        public string Name
        {
            get { return _name; }
        }

        public string this[string type]
        {
            get
            {
                switch (type)
                {
                    case "手机": return _mobilePhone;
                    case "住宅": return _homePhone;
                    case "办公": return _busiPhone;
                    case "传真": return _fax;
                    default: return "暂无";
                }
            }
            set
            {
                switch (type)
                {
                    case "手机": _mobilePhone = value; break;
                    case "住宅": _homePhone = value; break;
                    case "办公": _busiPhone = value; break;
                    case "传真": _fax = value; break;
                }
            }
        }
        public Contact(string name)
        {
            _name = name;
        }
    }
}
